<template>
  <div class="main">
    <div class="content">
      <div class="content_form">
        <el-form ref="form" :model="form" label-width="140px" class="form_item" :rules="rules">
          <el-row :gutter="24">
            <el-col :span="20">
              <el-form-item label="公告标题" prop="title">
                <el-input :disabled="true" v-model="form.title"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="20">
              <el-form-item label="发布人" prop="pushByUser">
                <el-input :disabled="true" v-model="form.pushByUser"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="20">
              <el-form-item label="发布部门" prop="deptName">
                <el-input :disabled="true" v-model="form.deptName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="20">
              <el-form-item label="公告内容" prop="notices">
                <el-input :disabled="true" v-model="form.notices" type="textarea" autosize></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </div>
  </div>
</template>
<script>
import { getToken, setToken, removeToken } from '@/utils/auth';
import { roleDeptTreeselect1s,checkNoticeStatus,getNoticeId_one,to_examine_NoticeId} from '@/api/user';
export default {
    components: {},
    data() {
        return {
            engineering: '',
            engineeringTypeOption: [],
            form: {
                title: '',
                isShow: '',
                notices: '',
                deptName:'',
                pushByUser:'',
                auditStatus:'',
                id:''
            },
            data:[],
            id:'',
            rules: {
                title: [{ required: true, message: '请填写内容', trigger: 'blur' }]
            },
			id_id:""
        };
    },
    created() {
        roleDeptTreeselect1s()
            .then(response => {
                if (response.data.code == 200) {
                    this.data = response.data.depts;
                    consolwe.log(response.data)
                } else {
                }
            })
            .catch(() => {
            });
        //  AuditNotice().then(response => {
        //     console.log('44444'+response)
        //   }) 
    },
    methods: {
        // 保存
        auditSave() {
            var params_one = {
                id:this.form.id,
                auditStatus:this.form.auditStatus
            };
            console.log(params_one)
            checkNoticeStatus(params_one)
                .then(response => {
                    this.$emit('closeModal', false);
                })
                .catch(() => {
                    // this.loading = false
                    // this.$message.error(response.data.msg)
                });
        },
		/**********审核回显***********/
		modify_display_notice(){
			
			
			 this.id_id=this.EngineeringData[0].id
			 
			var roleId={
				id:this.EngineeringData[0].id
			}
			getNoticeId_one(roleId).then((response) => {
			
				if(response.data.code == 200){
						console.log("我是修改的回显数据",response)
						this.form=response.data.data
						
				}else{
					this.$message.error(response.data.msg);
				}
			}).catch(() => {
				// console.log("我是点击了取消")
			})
		},
		/**********审核回显**********/
		/*****审核********/
		to_examine_noticeId(index){
			
			var roleId={
				id:this.id_id,
				type:index
			}
			console.log("==---",roleId)
			to_examine_NoticeId(roleId).then((response) => {
				console.log("===点击审核==")
				if(response.data.code == 200){
					
						if(index==1){
							this.$message({
								  message: '审核成功',
								  type: 'success'
							 });
							 // this.$emit('getTableData');
							  // this.$parent.getTableData();
							  // this.$parent.getTableData();
							  this.$emit('closeModal', false);
						}else if(index==3){
							this.$message({
								  message: '审核被拒',
								  type: 'success'
							 });
							 this.$emit('closeModal', false);
							 // this.$parent.getTableData();
							  // this.$emit('getTableData');
							 // this.$parent.getTableData();
						}
						// this.$parent.getTableData();
				}else{
					this.$message.error(response.data.msg);
				}
			}).catch(() => {
				// console.log("我是点击了取消")
			})
		}
		/******审核******/
    },
  props: ["EngineeringData"],
  mounted: function() {
    //异步加载
    // this.form = this.EngineeringData[0];
  },
  watch: {
    EngineeringData() {
      //数据监视
      this.form = this.EngineeringData[0];
    }
  }
};
</script>
<style scoped>
</style>